package be.jabapage.snooker.service.administration.api;

import java.util.Set;

import be.jabapage.snooker.exception.EntityNotFoundException;
import be.jabapage.snooker.exception.MultipleInstanceFoundException;
import be.jabapage.snooker.jdo.administration.Region;

/**
 * 
 * CRUD service for the Region
 * @author axesq
 *
 */
public interface IRegionService {

	/**
	 * 
	 * Store or update a region in the data store
	 * @param region
	 */
	void store(Region region);

	/**
	 * Retrieve a region by the key
	 * @param key
	 * @return Region
	 * @throws EntityNotFoundException when no record is found
	 */
	Region retrieve(Long key) throws EntityNotFoundException;

	/**
	 * Delete the instance with this key from the datastore.
	 * @param key
	 * @throws EntityNotFoundException when the instance is not found;
	 */
	void delete(Long key) throws EntityNotFoundException;

	/**
	 * Retrieve a region by the name
	 * @param name
	 * @return
	 * @throws MultipleInstanceFoundException when more then one instance is found.
	 * @throws EntityNotFoundException when no record is found
	 */
	Region retrieve(String name) throws MultipleInstanceFoundException, EntityNotFoundException;

	/**
	 * Retrieves a list of region depending on the search criteria.  Wildcards are allowed.
	 * @param name
	 * @return a {@link Set}
	 */
	Set<Region> search(String name);
}
